/*********************************
 * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms.
 * Copyright (c) 2012 NVision Group, Inc. All rights reserved.
 *
 * Maskables.java 12.10.2012 21:12:29
 *********************************/
package ru.kruzhki.client.gwt;

import static com.google.common.base.Preconditions.checkNotNull;

import com.sencha.gxt.widget.core.client.Component;

/**
 * @author starasov
 *
 */
public final class Maskables {

    private static Maskable MOCK_MASKABLE=new Maskable() {
        @Override
        public void unmask() {
            //do nothing
        }
        
        @Override
        public void mask(String message) {
            //do nothing
        }
        
        @Override
        public void mask() {
            //do nothing
        }
    };



    private Maskables() {
        throw new AssertionError("Util class");
    }
    public static Maskable newMaskable(final Component component){
        checkNotNull(component,"component");
        return new Maskable() {
            @Override
            public void unmask() {
                component.unmask();
            }
            
            @Override
            public void mask(String message) {
                component.mask(message);
            }
            
            @Override
            public void mask() {
                component.mask();
            }
        };
    }

    public static Maskable getMockMaskable() {
        return MOCK_MASKABLE;
    }
    
}
